VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ClsQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Clase para generar sqls arbitrarios (se usa solo para vistas y reportes)

Public Event DataChanged()

Public WithEvents orset As ClsRecordset
Attribute orset.VB_VarHelpID = -1

Public valores_fila As Variant

'Constructor y Destructor
Private Sub Class_Initialize()
    Set orset = New ClsRecordset
    ReDim valores_fila(0) As String
End Sub
Private Sub Class_Terminate()
    Set orset = Nothing
End Sub
' Generic Data management methods
Public Sub consulta(sqlvar As String)
    orset.AbreRec sqlvar
    ReDim valores_fila(orset.numCampos - 1) As String
    Reload_members
End Sub
Private Sub Reload_members()
    Dim i As Integer
    If orset.numRegistros > 0 Then
        For i = 0 To orset.numCampos - 1
            valores_fila(i) = orset.getDato(orset.getCampo(i))
        Next
    End If
    RaiseEvent DataChanged
End Sub
Public Function m_rec() As ADODB.Recordset
    Set m_rec = orset.mrec
End Function
'para leer datos por nombre de columna
Public Function getDato(nombreCampo As String)
    getDato = orset.getDato(nombreCampo)
End Function
'Metodos del Recordset
Public Sub reset()
    Set orset = Nothing
    Set orset = New ClsRecordset
    ReDim valores_fila(0) As String
End Sub
Private Sub orset_DataChanged()
    Reload_members
End Sub

